#pragma once

#include <iostream>
#include <string>

#include "Connection.hpp"
#include "Reactor.hpp"
#include "Log.hpp"

class Echo
{
public:
    void EchoService(Connection* conn)
    {
        std::string message = "Echo: ";
        message += conn->Inbuffer();
        conn->AppendOutbuffer(message);
        // 激活conn的写事件关系，让他调用它的发送方法
        conn->_R->EnableConnectionReadWrite(conn->Sockfd(), true, true);

        LOG(DEBUG, "EchoService success\n");
    }
};
